package com.jinhao.crowd.service.impl;

import com.jinhao.crowd.entity.po.MemberPO;
import com.jinhao.crowd.entity.po.MemberPOExample;
import com.jinhao.crowd.exception.LoginAcctRepeatException;
import com.jinhao.crowd.exception.LoginFailedException;
import com.jinhao.crowd.mapper.MemberPOMapper;
import com.jinhao.crowd.service.MemberPOService;
import com.jinhao.crowd.util.CrowdConstant;
import com.jinhao.crowd.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created on 2021/10/6.
 *
 * @author Valar Morghulis
 */

@Transactional(readOnly = true)
@Service
public class MemberPOServiceImpl implements MemberPOService {

    @Autowired
    private MemberPOMapper memberPOMapper;

    @Override
    public MemberPO getMemberByLoginAcct(String loginacct) {

        MemberPOExample memberPOExample = new MemberPOExample();
        MemberPOExample.Criteria criteria = memberPOExample.createCriteria();
        criteria.andLoginacctEqualTo(loginacct);

        List<MemberPO> memberPOList = memberPOMapper.selectByExample(memberPOExample);
        MemberPO memberPO = memberPOList.get(0);
        return memberPO;
    }
}
